<?php
/**
 * @content: Trace
 * @author: xuch
 */
class Trace {
	private static $_instance = NULL;
	private static $_log = array();
	
	private function __construct () {}
	
	private function __clone () {}
	
	public function create () {
		if (self::$_instance === NULL) {
			return new self();	
		}	
		return self::$_instance;
	}
	
	/**
	 * 将程序调用堆栈压入数组
	 */
	public function push ($str) {
		array_push(self::$_log, $str);	
	}
	
	/**
	 * 直接在页面上输出trace记录
	 */
	public function cat () {
		var_dump(self::$_log);
	}
}